﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="SchedulingInfoManage .aspx.cs" Inherits="RegisterWeb.Manager.DoctorPersonalCenter.SchedulingInfo" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <title></title>
    <link href="../../css/main.css" rel="stylesheet" type="text/css" />
    <link href="../../js/jquery-easyui-1.2.6/themes/gray/easyui.css" rel="stylesheet"
        type="text/css" />
    <link href="../../js/jquery-easyui-1.2.6/themes/icon.css" rel="stylesheet" type="text/css" />
    <script src="../../js/jquery-easyui-1.2.6/jquery-1.7.2.min.js" type="text/javascript"></script>
    <script src="../../js/jquery-easyui-1.2.6/jquery.easyui.min.js" type="text/javascript"></script>
    <script src="../../js/jquery-easyui-1.2.6/locale/easyui-lang-zh_CN.js" type="text/javascript"></script>


<script type="text/javascript">

    var url; //提交数据的路径
    var formId; //当天要提交的Form的编号
    var dialogId; //对话框的编号

    var successCallback = function (result) {
        // alert(result);
        //result为请求处理后的返回值
        var result = eval('(' + result + ')');
        if (result.success) {
            $.messager.show({
                title: 'Success',
                msg: result.msg
            });
            $(dialogId).dialog('close');
            $('#dg').datagrid('reload');
        } else {
            $.messager.show({
                title: 'Error',
                msg: result.msg
            });
        }
    }

    $(function () {
        //预加载编辑框
        $("#addSchAdjustment").dialog('refresh');
        $("#addSchAdjustment").dialog({
            modal: true,
            "title": "调整申请",
            width: 570,
            height: 400,
            href: 'AddSchedulingAdjustment.aspx'
        });
        $("#addSchAdjustment").dialog('open').dialog('close');

    });
    
    function makeSure() {

        var row = $('#dg').datagrid('getSelected');
        
        //先不考虑已确认的情况
      
           // if (data == 'no') {
        if (row) {
            var str = row.SchedulingInfo_ConfirmStatus;
            if (str.toString().indexOf("待确认") > 0) {
                $.post('ashx/SchedulingInfoHandler.ashx?action=makeSure', { action: 'makeSure', id: row.SchedulingInfo_ID }, function (data, status) {
                    if (data == "ok") {
                        $.messager.show({ title: '确认提示', msg: '确认成功!' });
                        $('#dg').datagrid("reload");
                    }
                    else {
                        $.messager.show({ title: '确认提示', msg: '确认失败!' });
                    }
                });
            }
            else if (str.toString().indexOf("已确认") > 0) {
                $.messager.show({ title: '确认提示', msg: '您已经确认!' });
            }
            else {
                $.messager.show({ title: '确认提示', msg: '正在审核中,确认无效!' });
            }
        }
        else {
            $.messager.alert("提示", "您没有选中任何行！");

        }

           // }
           // else {
             //   $.messager.alert("提示", "该医院已配置,可以到配置表中进行查看!", "info"); return;
          //  }


            }

      
            //添加调整申请
            function SchAdjustment() {

                var row = $('#dg').datagrid('getSelected');
                if (row) {
                    //$("#addSchAdjustment").dialog('refresh');
                    $('#addSchAdjustment').dialog('open');

                    $('#SchedulingAdjustment_TimeTye').combobox('setValue', row.SchedulingInfo_TimeTypeValue);
                    $('#SchedulingAdjustment_DayTime').datebox('setValue', row.SchedulingInfo_DayTime);
                    $('#SchedulingAdjustment_OutpaientType').combobox('setValue', row.SchedulingInfo_OutpatientTypeValue);
                    $('#SchedulingAdjustment_RegisteredNumber').numberspinner('setValue', row.SchedulingInfo_RegisteredNumber);
                    //$('#SchedulingAdjustment_Note').val(row.SchedulingAdjustment_Note);

                    url = 'ashx/SchedulingInfoHandler.ashx?action=add&id=' + row.SchedulingInfo_ID;  
                    formId = "#add";
                    dialogId = "#addSchAdjustment";

                }
                else {
                    $.messager.alert("提示", "您没有选中任何行！");
                }
            }
            function saveInfo() {
                $(formId).form('submit', {
                    url: url,
                    onSubmit: function () {
                        return $(this).form('validate');
                    },
                    success: successCallback
                });
            }
</script>

</head>
<body>
    <form id="form1" >
    <div region="center" title="医生排班确认" >
<table id="dg" title="医生排班确认" class="easyui-datagrid" style="overflow:auto ; height:550px"
			url="ashx/SchedulingInfoHandler.ashx?action=get"
			toolbar="#toolbar" pagination="true"
			rownumbers="true" fitColumns="true" singleSelect="true" 
            pageSize="20"
            >
		<thead>
			<tr>
			<th idField="SchedulingInfo_ID" width="50" hidden="true">安排编号</th>
			<th field="Departments_ID" width="40">所在科室</th>
				<th field="Doctor_ID"  width="40">医生名称</th>
				<th field="SchedulingInfo_TimeType"  width="50">类型</th>
                	<th field="SchedulingInfo_TimeTypeValue" hidden="true"  width="50">类型值</th>
                 <th field="SchedulingInfo_DayTime"  width="30"> 日期</th>
                <th field="SchedulingInfo_OutpatientType" width="40">门诊类型</th>
                <th field="SchedulingInfo_OutpatientTypeValue" width="40" hidden="true">门诊类型值</th>
                 <th field="SchedulingInfo_RegisteredNumber" width="20">可挂号数量</th>
                 <th field="SchedulingInfo_AddTime" width="30" >安排时间</th>
                 <th field="SchedulingInfo_Recoder" width="50" hidden="true">安排者</th>
                 <th field="SchedulingInfo_ConfirmStatus" width="30">确认状态</th>
                 
                 <th field="SchedulingInfo_Status" width="10" hidden="true">状态</th>
               <th field="Operate" width="40">操作</th>
			</tr>
		</thead>
	</table>

    <div id="toolbar" style="padding:5px;height:auto;color:#0000ee">
					<!--<a href="#" class="easyui-linkbutton" iconCls="icon-add" plain="true" onclick="">排班确认</a>
                    <a href="#" class="easyui-linkbutton" iconCls="icon-edit" plain="true" onclick="">申请调整</a>
                 -->
                 说明:请认真核实自己的排班信息并进行确认，如有问题，可以通过申请调整进行变更, 待审核通过再次进行确认！
    </div>


			<div id="addSchAdjustment" class="easyui-dialog" closed="true" buttons="#addSchAdjustment-buttons" style="padding:10px 20px">
        	</div>
			<div id="addSchAdjustment-buttons">
				<a href="#" class="easyui-linkbutton" iconCls="icon-ok" onclick="saveInfo()">提交</a>
				<a href="#" class="easyui-linkbutton" iconCls="icon-cancel" onclick='$("#addSchAdjustment").dialog("close");'>关闭</a>
			</div>

         

    </div>
    </form>
</body>
</html>

